package com.gzhryc.shared_device.base.enums;

public enum EPayState {

    Wait(1, "等待支付"), Success(2, "支付成功"), Fail(3, "支付失败"),
    Close(4, "交易关闭"), Cancel(5, "撤销支付"), Confirm(6, "预支付确认")
    , FinishToWaitPay(7, "商户完结，等待支付");

    private Integer index;
    private final String note;

    EPayState(Integer index, String note) {
        this.index = index;
        this.note = note;
    }

    public Integer index() {
        return index;
    }

    public String note() {
        return note;
    }

    public static String note(Integer index) {
        EPayState[] temp = EPayState.values();
        for (int i = 0; i < temp.length; i++) {
            EPayState item = temp[i];
            if (item.index.equals(index)) {
                return item.note;
            }
        }
        return null;
    }

    public static EPayState get(Integer index){
        EPayState[] temp = EPayState.values();
        for (int i = 0; i < temp.length; i++) {
            EPayState item = temp[i];
            if (item.index.equals(index)) {
                return item;
            }
        }
        return null;
    }

}
